
#ifndef SX_COMPONENT_H
#define SX_COMPONENT_H

#include <sxRenderable.h>
#include <sxArrayList.h>
#include <sxRectangle.h>
#include <sxString.h>

namespace Sx {
namespace Interface {

class KeyListener;
class MouseListener;

/* 
 * The Component class provides a display of a 2D component/widget that is
 * presented on a 2D interface.
 */
class Component : public Renderable {
public:
	Component();
	virtual ~Component();

	virtual bool initialize() = 0;
	virtual void render() const = 0;
	virtual void resize(int width, int height) = 0;

	bool addKeyListener(KeyListener* listener);
	bool addMouseListener(MouseListener* listener);
	bool removeKeyListener(KeyListener* listener);
	bool removeMouseListener(MouseListener* listener);

	Graphics::Rectanglei getView() const;

protected:
	/*
	 * Defines the geometric view in screen space provided by this viewport.
	 * Typically this is x=0, y=0, width, and height.
	 */
	Graphics::Rectanglei view;

	/* POINTER_OWNERSHIP: NO */
	Util::ArrayList<KeyListener*> keyListeners;
	Util::ArrayList<MouseListener*> mouseListeners;
};

}

}

#endif
